home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
timetrak
/
ttrakpxg.bas
< prev
Wrap
BASIC Source File
|
1995-09-06
|
15KB
|
344 lines
'******* Declarations for Using the Paradox 3.5 Engine ******
Declare Function PXWinInit Lib "Pxengwin.dll" (ByVal Application$, ByVal Mode%) As Integer
Declare Function PXExit Lib "Pxengwin.dll" () As Integer
'************ TABLE FUNCTIONS *****************
Declare Function PXTblOpen Lib "Pxengwin.dll" (ByVal TblName$, TblHnd%, ByVal index%, ByVal change%) As Integer
Declare Function PXTblClose Lib "Pxengwin.dll" (ByVal TblHnd%) As Integer
'************* RECORD FUNCTIONS *******************
Declare Function PXRecAppend Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal RecHnd%) As Integer
Declare Function PXRecInsert Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal RecHnd%) As Integer
Declare Function PXRecUpdate Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal RecHnd%) As Integer
Declare Function PXRecDelete Lib "Pxengwin.dll" (ByVal TblHnd%) As Integer
Declare Function PXRecBufOpen Lib "Pxengwin.dll" (ByVal TblHnd%, RecHnd%) As Integer
Declare Function PXRecBufClose Lib "Pxengwin.dll" (ByVal RecHnd%) As Integer
Declare Function PXRecBufEmpty Lib "Pxengwin.dll" (ByVal RecHnd%) As Integer
Declare Function PXRecGet Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal RecHnd%) As Integer
Declare Function PXRecFirst Lib "Pxengwin.dll" (ByVal TblHnd%) As Integer
Declare Function PXRecNext Lib "Pxengwin.dll" (ByVal TblHnd%) As Integer
Declare Function PXRecPrev Lib "Pxengwin.dll" (ByVal TblHnd%) As Integer
Declare Function PXRecNum Lib "Pxengwin.dll" (ByVal TblHnd%, RecNum%) As Integer
Declare Function PXTblNRecs Lib "Pxengwin.dll" (ByVal TblHnd%, nRecs%) As Integer
'**************** FIELD FUNCTIONS ****************
Declare Function PXPutShort Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, ByVal sValue%) As Integer
Declare Function PXPutDoub Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, ByVal dValue#) As Integer
Declare Function PXPutLong Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, ByVal lValue&) As Integer
Declare Function PXPutAlpha Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, ByVal aValue$) As Integer
Declare Function PXPutBlank Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%) As Integer
Declare Function PXPutDate Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, ByVal inDate As Any) As Integer
Declare Function PXGetShort Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, sValue%) As Integer
Declare Function PXGetDoub Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, dValue#) As Integer
Declare Function PXGetLong Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, lValue&) As Integer
Declare Function PXGetAlpha Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, ByVal bufSize%, ByVal aValue$) As Integer
Declare Function PXFldBlank Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, ByVal Blank%) As Integer
Declare Function PXGetDate Lib "Pxengwin.dll" (ByVal RecHnd%, ByVal FldHnd%, outDate As Any) As Integer
Declare Function PXRecNFlds Lib "Pxengwin.dll" (ByVal TblHnd%, nFlds%) As Integer
Declare Function PXFldHandle Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal FldName$, FldHnd%) As Integer
Declare Function PXFldType Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal FldHnd%, ByVal BufSiz%, ByVal fldtype$) As Integer
Declare Function PXFldName Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal FldHnd%, ByVal BufSiz%, ByVal FldName$) As Integer
'*************** SEARCH FUNCTIONS *******************
Declare Function PXSrchKey Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal RecHnd%, ByVal nFlds%, ByVal Mode%) As Integer
Declare Function PXSrchFld Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal RecHnd%, ByVal FldNum%, ByVal Mode%) As Integer
'***************** MISCELLANEOUS FUNCTIONS ****************
Declare Function PXDateDecode Lib "Pxengwin.dll" (ByVal outDate As Any, mm%, dd%, yy%) As Integer
Declare Function PXDateEncode Lib "Pxengwin.dll" (ByVal mm%, ByVal dd%, ByVal yy%, pDate&) As Integer
'******************* NETWORK FUNCTIONS ******************
Declare Function PXNetUserName Lib "Pxengwin.dll" (ByVal buffer%, UserName$) As Integer
Declare Function PXNetFileLock Lib "Pxengwin.dll" (ByVal FileName$, ByVal lockType%) As Integer
Declare Function PXNetFileUnlock Lib "Pxengwin.dll" (ByVal FileName$, ByVal lockType%) As Integer
Declare Function PXNetTblLock Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal lockType%) As Integer
Declare Function PXNetTblUnlock Lib "Pxengwin.dll" (ByVal TblHnd%, ByVal lockType%) As Integer
Declare Function PXNetRecLock Lib "Pxengwin.dll" (ByVal TblHnd%, LockHnd%) As Integer
Declare Function PXNetRecLocked Lib "Pxengwin.dll" (ByVal TblHnd%, Locked%) As Integer
Declare Function PXNetTblChanged Lib "Pxengwin.dll" (ByVal TblHnd%, Changed%) As Integer
Declare Function PXNetTblRefresh Lib "Pxengwin.dll" (ByVal TblHnd%) As Integer
Function Gen_Date (vDate As String)
pos1% = InStr(1, vDate, "/")
mm = Val(Mid$(vDate, 1, pos1% - 1))
pos2% = InStr(pos1% + 1, vDate, "/")
dd = Val(Mid$(vDate, pos1% + 1, pos2% - pos1% - 1))
temp$ = Mid$(vDate, pos2% + 1, 4)
If Len(temp$) = 4 Then
yy = Val(Mid$(temp$, 3, 2))
Else
yy = Val(temp$)
End If
If (mm < 1 Or mm > 12 Or dd < 1 Or yy < 1) Then
eflag% = 1
ElseIf mm = 2 And dd > 28 Then
eflag% = 1
ElseIf (mm = 4 Or 6 Or 9 Or 11) And dd > 30 Then
eflag% = 1
ElseIf dd > 31 Then
eflag% = 1
End If
If eflag% = 1 Then
Gen_Date = 1
Else
Gen_Date = 0
rc = PXDateEncode(mm, dd, yy, lValue)
End If
End Function
Sub GetField (RecHnd%, FldHnd%, fldtype$)
returnFld = ""
aValue = ""
lValue = 0
dValue = 0
Select Case Mid$(fldtype$, 1, 1)
Case Is = "A"
rc = PXGetAlpha(RecHnd%, FldHnd%, 255, aValue)
PXError
returnFld = aValue
Case Is = "N"
rc = PXGetLong(RecHnd%, FldHnd%, lValue)
PXError
' If lValue < 0 Then
' lValue = 0
' End If
returnFld = Format$(lValue, "###0")
Case Is = "$"
rc = PXGetDoub(RecHnd%, FldHnd%, dValue)
PXError
' If dValue < 0 Then
' dValue = 0
' End If
returnFld = Format$(dValue, "###,##0.00")
Case Is = "D"
rc = PXGetDate(RecHnd%, FldHnd%, lValue)
PXError
rc = PXDateDecode(lValue, mm, dd, yy)
returnFld = LTrim$(Str$(mm)) + "/" + LTrim$(Str$(dd)) + "/" + LTrim$(Str$(yy))
End Select
End Sub
Sub PutField (RecHnd%, FldHnd%, fldtype$)
Select Case Mid$(fldtype$, 1, 1)
Case Is = "A"
rc = PXPutAlpha(RecHnd%, FldHnd%, aValue)
PXError
Case Is = "N"
rc = PXPutBlank(RecHnd%, FldHnd%)
PXError
rc = PXPutLong(RecHnd%, FldHnd%, lValue)
PXError
Case Is = "$"
rc = PXPutBlank(RecHnd%, FldHnd%)
PXError
' rc = PXPutLong(RecHnd%, FldHnd%, lValue)
rc = PXPutDoub(RecHnd%, FldHnd%, dValue)
PXError
Case Is = "D"
rc = PXPutDate(RecHnd%, FldHnd%, lValue)
PXError
End Select
End Sub
Sub PXError ()
Dim msgbuf As String
If rc = 0 Then
Exit Sub
End If
' msgbuff = Code + "=" + Str$(rc)
' msgbuff = PXErrMsg(rc)
Select Case rc
Case Is = NOT_PROGRAMMED
msgbuf = " Code Not Finished"
Case Is = PXERR_NOTINITERR
msgbuf = " Engine not initialized"
Case Is = PXERR_ALREADYINIT
msgbuf = "Engine already initialized"
Case Is = PXERR_NOTLOGGEDIN
msgbuf = " Could not log onto network"
Case Is = PXERR_NONETINIT
msgbuf = " Engine not initialized"
Case Is = PXERR_NETMULTIPLE
msgbuf = " multiple PARADOX.NET files"
Case Is = PXERR_CANTSHAREPDOXNET
msgbuf = " can't lock PARADOX.NET-is SHARE.EXE loaded?"
Case Is = PXERR_WINDOWSREALMODE
msgbuf = " can't run Engine in Windows real mode"
Case Is = PXERR_DRIVENOTREADY
msgbuf = " Drive not ready"